<!DOCTYPE html>
<html lang="en">
<head>
  {{template "pc/public/mycss.html" .}}
</head>
<style type="text/css">
	#wrapper{
		background: #f5f5f5!important;
	}
	.header-center{
		background: #fff;
	}
	.user_left{
		background: #fff;
	}
	.fenlei{
		width: 20%;
	}
	
	@media (max-width: 992px){
		.fenlei{
		    width: 100%;
		}
	}
</style>
<body class="common-home res layout-home1 setpassword">
<div id="wrapper" class="wrapper-full banners-effect-7">
	<!-- Header Container  -->
  {{template "pc/public/head.html" .}}
  {{template "pc/public/mytop.html" .}}
	<div class="main-container container">
		<div class="row mb-50">
			<!--Left Part Start -->
			{{template "pc/public/myleft.html" .}}
			<!--Middle Part Start-->
			<div id="content" class="col-md-10 col-sm-8 right mt-15">
        <form>
        <p class="hd">修改密码</p>
        <p><span>原密码：</span><input type="password" name="oldpwd" placeholder="请输入原密码"></p>
        <p class="desc">Tip：如果没有设置密码，原密码框留空</p>
        <p><span>新密码：</span><input type="password" name="newpwd" placeholder="请输入新密码"></p>
        <p><span>确认密码：</span><input type="password" name="newpwd2" placeholder="请再次输入新密码"></p>
        </form>
        <p><button id="save">确定修改</button></p>
      </div>
		</div>
	</div>
</div>

<!-- Footer Container -->
{{template "pc/public/foot.html" .}}
{{template "pc/public/myfoot.html" .}}
</body>
</html>
<script type="text/javascript">
  $('#save').click(function(){
    var form=$('form').serialize()
    if(!$('input[name="newpwd"]').val()){showToast('新密码不能为空!'); return false; };
    if($('input[name="newpwd"]').val()!=$('input[name="newpwd2"]').val()){showToast('两次输入密码不一致~'); return false; };
    $.ajax({
      url:window.location.href,
      type:'post',
      data:form,
      success:function(res){
        if (res==1) {
          showToast("保存成功!");
          setTimeout(function(){window.location.href=document.referrer}, 1000)
        }else if(res==0){
          showToast("网络繁忙,请稍后再试!");
        }else if(res==2){
          showToast('原密码错误!')
        }else{
          showToast('网络繁忙,请稍后再试')
        }
      }
    })
  })
</script>
